package com.example.mapstruct.convert;

import com.example.mapstruct.convert.TestMapper;
import com.example.mapstruct.enums.DisableStatus;
import com.example.mapstruct.enums.LevelEnum;
import org.springframework.stereotype.Component;

//@Component
public class TestMapperImpl2 implements TestMapper {

    @Override
    public LevelEnum toEnum(DisableStatus disableStatus) {
        if ( disableStatus == null ) {
            return LevelEnum.PASS;
        }

        LevelEnum levelEnum;

        switch ( disableStatus ) {
            case able_status: levelEnum = LevelEnum.normal_status;
                break;
            case failed_status: levelEnum = null;
                break;
            case normal_status: levelEnum = LevelEnum.normal_status;
                break;
            default: levelEnum = LevelEnum.normal;
        }

        return levelEnum;
    }
}